#!/bin/bash
#
#  Masalla Icon Theme
#
#  Copyright 2022 hayder majid <hayder@riseup.net>
#  
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 3 of the License, or
#  (at your option) any later version.
#  
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#  
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, you can download it from here:
#  https://www.gnu.org/licenses/gpl-3.0.html
#
# installing script for masalla icon themes 
# Thanks to Tiheum <matthieu.james@gmail.com> for writting his script :-) 

echo ""
cat Banner1.txt
sleep 1.5
cat Banner2.txt
sleep 1.5
cat Banner3.txt
sleep 1.5
ROOT_UID=0
if [ "$UID" -ne "$ROOT_UID" ]
then
	echo "Masalla Icon themes will be installing in $HOME/.icons. To make them available for all users, run this script as root."
else
	echo "Masalla Icon themes will be installing in /usr/share/icons and will be available for all users."
fi
echo ""
read -p "Do you want to continue ? [Y]es, [N]o : " response
case $response in
	[Yy]* ) ;;
    [Nn]* ) exit 99;;
    * ) echo "Wrong value: installaton aborted."; exit 1;;
esac


if [ "$UID" -eq "$ROOT_UID" ]
then
	./CLEAN
	cp -R ./masalla /usr/share/icons/
	cp -R ./masalla-dark /usr/share/icons/
    sudo gtk-update-icon-cache  /usr/share/icons/masalla*
	install_dir=/usr/share/icons/
else
	./CLEAN
	cp -R ./masalla $HOME/.icons/
	cp -R ./masalla-dark $HOME/.icons/
    sudo gtk-update-icon-cache  $HOME/.icons/masalla*
	install_dir=$HOME/.icons/
fi
echo ""
echo "Your new icon theme Masalla installed in $install_dir"
echo "To find the latest update, please check the main repository :"
echo " https://notabug.org/masalla-art/masalla-icon-theme"
echo ""
echo "Installation complete. Enjoy !"
exit 0
